using System;
using Klear.Library.Services;
using Klear.Library.ViewModels;

namespace Klear.Services;

public class ContentNavigationService : IContentNavigationService
{
    public void NavigateTo(string view, object parameter = null)
    {
        ViewModelBase viewModel = view switch
        {
            ContentNavigationConstant.BudgetListView => ServiceLocator.Current
                .BudgetListViewModel,
            _ => throw new Exception("未知的视图。")
        };
        
        viewModel.SetParameter(parameter);
        
        ServiceLocator.Current.MainViewModel.PushContent(viewModel);
    }
}